﻿package net.wangit.dev.wizard;

import java.util.List;

import net.wangit.dev.wizard.element.ABackButton;
import net.wangit.dev.wizard.element.ADeleteActionButton;
import net.wangit.dev.wizard.element.AEditLink;
import net.wangit.dev.wizard.element.ANewButton;
import net.wangit.dev.wizard.element.ASaveActionButton;
import net.wangit.dev.wizard.element.AScanLink;
import net.wangit.dev.wizard.unit.AFormUnit;
import net.wangit.dev.wizard.unit.AListUnit;


public class OneTableSuiteProcessor3 extends OneTableSuiteProcessor {

	public OneTableSuiteProcessor3() {
	}

	public void createUnits() throws Exception {
		AListUnit.create(db, domain, groupId, listUnitId, listUnitName,
				tableName, queryUnitId, null, false, 1, true, null);
		List<String> elements = Table2Unit.create(db, listUnitId, tableName,
				2, null);
		String url = WizardUtil.getNewUrl(domain, formUnitId);
		ANewButton.create(db, ac, listUnitId, elements, url);
		ADeleteActionButton.create(db, ac, domain, 2, listUnitId, tableName,
				null, WizardUtil.getUrl(domain, listUnitId, "s"), elements);
		AScanLink.create(db, ac, domain, listUnitId, formUnitId, formUnitId,
				tableName, elements);
		AEditLink.create(db, ac, domain, listUnitId, formUnitId, formUnitId,
				tableName, elements);
		AFormUnit.create(db, domain, groupId, formUnitId, formUnitName,
				tableName, 1, null);
		elements = Table2Unit.create(db, formUnitId, tableName, 1, null);
		ABackButton.create(db, ac, formUnitId, WizardUtil.getUrl(domain,
				listUnitId, "s"), elements);
		ASaveActionButton.create(db, ac, formUnitId, tableName, WizardUtil
				.getUrl(domain, formUnitId, "e"), elements, null, null, null);
	}

	protected String[][] getUnits() {
		return (new String[][] { new String[] { listUnitId, "listunitid" },
				new String[] { formUnitId, "formunitid" } });
	}
}
